#
# nlp 'pip install nltk' 
# pip install urllib3
# matplotlib
# Tokenize
#

import urllib.request
from bs4 import BeautifulSoup
import nltk
from nltk.corpus import stopwords

response = urllib.request.urlopen("http://php.net")
html = response.read()
soup = BeautifulSoup(html, "html5lib")
text = soup.get_text(strip=True)
tokens = [t for t in text.split()]

clean_tokens = list()
sr = stopwords.words('english')
for token in tokens:
	if not token in sr:
		clean_tokens.append(token)

freq = nltk.FreqDist(clean_tokens)
#for key, val in freq.items():
#	print (str(key) + ":" + str(val))

print ("Start to show in graph")

freq.plot(20, cumulative=False)
